﻿using UnityEngine;
using System.Collections;

public class WeDontNeedNoWater : MonoBehaviour {
	/*
	 public ParticleSystem smokey;
    public ParticleSystem firey;
		public ParticleSystem exploosh;
	*/
	
	public GameObject smokey;
    public GameObject firey;
	public GameObject exploosh;
	float newTime;
	
	float timeMyShit;
	float burnBabyBurn;
		float burnBabyBurn2;
		float burnBabyBurn3;
			
	bool oneanddone;
		bool twoanddone;
		bool threeanddone;
	Quaternion pieceRotation = Quaternion.AngleAxis(270, Vector3.up);

	// Use this for initialization
	void Start () {
	burnBabyBurn = Random.Range(1,6);
		burnBabyBurn2 = Random.Range(6,12);
		burnBabyBurn3 = Random.Range(12,20);
		oneanddone = true;
			twoanddone = true;
			threeanddone = true;
	}
	
	// Update is called once per frame
	void Update () {
		
	timeMyShit = Time.time;
		if(timeMyShit> burnBabyBurn && oneanddone){

		
			GameObject smokeyRef = Instantiate(smokey, transform.position, pieceRotation) as GameObject ;
			Destroy(smokeyRef,4);
			newTime = timeMyShit;
			Debug.Log(newTime);
			oneanddone = false;
			
		}
		//if(timeMyShit> burnBabyBurn2 && twoanddone ){
		if(twoanddone && (newTime + 4 <= timeMyShit)){
		GameObject  fireyRef=  Instantiate(firey,transform.position,pieceRotation)as GameObject;
				Destroy(fireyRef,4);
				Debug.Log(newTime);
			twoanddone = false;
			
				newTime = timeMyShit;
		}
		//if(timeMyShit> burnBabyBurn3  && threeanddone){
		if(threeanddone && (newTime + 4 <= timeMyShit)){
			GameObject  explooshRef = Instantiate(exploosh, transform.position, pieceRotation) as GameObject;
				Destroy(explooshRef,1);
			
			threeanddone= false;
			Destroy(gameObject);
		}
		if(timeMyShit > burnBabyBurn3 + 2){
			
		}
	}
}
